package com.example.projuct.demos.week.week3.chapter2_2;

/**
 * @author jll
 * @createTime 2025/4/27
 * @description 学科实体类
 * @version: 1.0
 */
public class Subject {
    //成员属性  学科名称、学科编号、学制年限
    private String subjectName;
    private String subjectNumber;
    private int subjectLife;

    //构造方法
    public Subject() {
    }

    //构造方法
    public Subject(String subjectName, String subjectNumber, int subjectLife) {
//        this.subjectName = subjectName;
//        this.subjectNumber = subjectNumber;
//        this.subjectLife = subjectLife;
        //建议采用方法赋值的方式
        this.setSubjectName(subjectName);
        this.setSubjectNumber(subjectNumber);
        this.setSubjectLife(subjectLife);
    }


    public String getSubjectName() {
        return subjectName;
    }

    public void setSubjectName(String subjectName) {
        this.subjectName = subjectName;
    }

    public String getSubjectNumber() {
        return subjectNumber;
    }

    public void setSubjectNumber(String subjectNumber) {
        this.subjectNumber = subjectNumber;
    }

    public int getSubjectLife() {
        return subjectLife;
    }

    public void setSubjectLife(int subjectLife) {
        this.subjectLife = subjectLife;
    }

    public String info() {
        return "Subject{" +
                "subjectName='" + this.getSubjectName() + '\'' +
                ", subjectNumber='" + this.getSubjectName() + '\'' +
                ", subjectLife=" + this.getSubjectLife() +
                '}';
    }
}
